package chp09.homework;

import java.util.Scanner;

public class Home1 {

    public static void main(String[] args) {
        int[] nums = new int[5];
        Scanner input = new Scanner(System.in);
        for (int i = 0; i < nums.length; i++) {
            System.out.print("请输入一个正整数:");
            int num = input.nextInt();
            if(num > 0) {
                nums[i] = num;
                System.out.println("第"+(i+1)+"个数字录入成功!");
            }else{
                i--;
            }
        }

        for (int i = 0; i < nums.length; i++) {
            System.out.println(nums[i]);
        }
    }
}
